DECLARE @TABLA NVARCHAR(100)
,@COLUMNA NVARCHAR (100)
,@QRY NVARCHAR (100)
,@MAX NVARCHAR(100)

DECLARE @TEMP TABLE(NOMBRE VARCHAR (100), COLUMNA NVARCHAR(100), MAXID NVARCHAR(100)) 
--T @TABLA=N'Employees'

DECLARE QTABLAS CURSOR FOR
  SELECT T.name, C.name
 FROM sys.tables AS T
   JOIN sys.columns AS C ON T.object_id = C.object_id
   WHERE C.column_id = 1

  OPEN QTABLAS
  FETCH NEXT FROM QTABLAS INTO @TABLA, @COLUMNA
  WHILE @@FETCH_STATUS = 0
  BEGIN 
SET @QRY =N'SELECT @CANTIDAD = MAX' + QUOTENAME(@COLUMNA,'(') + ' FROM ' + QUOTENAME (@TABLA)
EXEC sp_executesql @QRY, N'@CANTIDAD NVARCHAR(100) OUTPUT',@CANTIDAD = @MAX OUTPUT

INSERT INTO @TEMP 
VALUES (@TABLA,@COLUMNA,@MAX)
FETCH NEXT FROM QTABLAS INTO @TABLA, @COLUMNA
END 
CLOSE QTABLAS
DEALLOCATE QTABLAS


SELECT * FROM @TEMP